package jtk.project4.fleet.ibatis.dao;

import java.sql.SQLException;
import java.util.List;

import nl.coderight.jazz.dialog.MessageDialog;
import nl.coderight.jazz.dialog.MessageType;
import jtk.project4.fleet.domain.Vendor;
import jtk.project4.fleet.domain.VendorType;




public class VendorsDao extends IbatisDao{
	
	public List selectVendors() throws SQLException {
		List selectVendors = null;
			selectVendors =getSqlMap().queryForList("SELECT_ALL_VENDOR", null);
		return selectVendors;
	}

	public int deleteVendor(Vendor vendor) throws SQLException{
		return (int) getSqlMap().delete("DELETE_VENDOR", vendor);
	}
	
	public int updateVendor(Vendor vendor) throws SQLException{
		return (int) getSqlMap().update("UPDATE_VENDOR", vendor);
	}
	
	public Vendor insertVendor(Vendor vendor) throws SQLException{
		return (Vendor) getSqlMap().insert("INSERT_VENDOR", vendor);
	}

	public Vendor insertVendorType(Vendor vendor) throws SQLException {
		return (Vendor) getSqlMap().insert("INSERT_VENDOR_TYPE",vendor);
	}
	
		public List selectVendorType() throws SQLException {
		return getSqlMap().queryForList("SELECT_ALL_VENDOR_TYPE", null);
	}
	
		
	public static void main (String args[]) throws SQLException{
		Vendor vendor;
		vendor = new Vendor();
		vendor.setName("testesd");
		new VendorsDao().insertVendor(vendor);
		System.out.println("SUDAH MASUK MAS!");
		}
	
}